fix(ember): Stop retaining component render payloads in beforeEntries - #23052
Open
yashschandra wants to merge 1 commit into
Open
fix(ember): Stop retaining component render payloads in beforeEntries#23052yashschandra wants to merge 1 commit into
yashschandra wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yashschandra
requested review from
nicohrubec and
s1gr1d
and removed request for
a team
August 5, 2026 10:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).Problem
_instrumentComponentssubscribes to Ember'srender.component(and optionallyrender.getComponentDefinition) instrumentation and stores{ payload, now }into a module-scopebeforeEntriesmap keyed bypayload.object(a per-component-instance GUID).processComponentRenderAfterreads the entry but never removes it, so every instrumented component render is retained for the lifetime of the page.Since the render
payloadreferences the component instance (view), this pins each destroyed component and everything it references. In our Ember app (Customer.io Journeys) this retained every destroyed message-composer graph when users switched between wizard steps — ~34 MB of unreclaimable heap per step switch, measured in Chrome with--js-flags=--expose-gcand confirmed via heap-snapshot retainer paths ending at the instrumentation subscriber'sbeforeEntriesclosure:Fix
processComponentRenderAfteronce the render completes.RenderEntriesfrom an index-signature object to aMap(the repo'sno-dynamic-deleteoxlint rule disallowsdeletewith dynamic keys, and aMapis the natural fit for GUID keys)._processComponentRenderBefore/_processComponentRenderAfter(following the existing_-prefixed pattern used byinstrumentEmberAppInstanceForPerformance) and add unit tests covering: entry removal on completion (both below and aboveminimumComponentRenderDuration), and that anafterwithout a matchingbeforeleaves other in-flight entries untouched.Verified in the affected app: with this change all destroyed component graphs become collectable and back-to-back heap snapshots across step-switch cycles show only ~0.5 MB/cycle of JIT-code growth instead of ~34 MB/cycle of retained objects.
🤖 Generated with Claude Code